#pragma once
#include "DXAMLCommon.h"
#include "CXcpList.h"

#include "CTypeTokenItem.h"
class CValueStore;

class CCustomTypeFactory
{
public: 
	HRESULT ResolveTypeName(const CXString *, const CXString *, void *, CTypeTokenItem * *);
	HRESULT CreateInstance(XUINT32, const CXString *, void * *, XUINT32);
	HRESULT CreateInstance(const CXString *, const CXString *, void *, const CXString *, void * *);
	HRESULT Clear();
	CCustomTypeFactory(CCoreServices *);
	~CCustomTypeFactory();
private: 
	HRESULT EnsureTypeTable();
	HRESULT CreateTypeTable();
	void CleanTypeTable();
	HRESULT AddToTypeTable(const CXString *, const CXString *, const CXString *, XUINT32, XUINT32, XUINT32, CTypeTokenItem * *);
	HRESULT FindTypeToken(const CXString *, const CXString *, CTypeTokenItem * *);
	HRESULT Initialize();
	CCoreServices * m_pCore;
	CValueStore * m_pTypeTable;
	CXcpList<CXcpList<CTypeTokenItem> > * m_pAllTypeTokenItemLists;
};
